/**
 * @(#) WorkFacade.as
 *
 * @date		2009. 02. 25.
 * @version		1.0
 * @author		Shin, Yunwoo
 * @description	module facade (근무)
 * 				mvc간 주고 받는 메세지를 정의하고,  command를 등록한다. 
 */
package com.skt.common_hr.work_nos
{
	import com.skt.common_hr.common.puremvc.CommonFacade;
	import com.skt.common_hr.work_nos.controller.StartupCommand;
	
	import flash.display.DisplayObject;
	
	public class WorkFacade extends CommonFacade
	{
		public static const STARTUP:String 						= 'startup';
		public static const CLOSE_MODULE:String					= 'closeModule';
		
		public static const RESTART_POPUP:String				= "restartPopUp";
		public static const LOAD_CALENDAR_COMPLETE:String		= "loadCalendarComplete";
		public static const LOAD_CALENDAR_FAILED:String			= "loadCalendarFailed";
		public static const LOAD_DATERANGE_COMPLETE:String		= "loadDateRangeComplete";
		public static const LOAD_DATERANGE_FAILED:String		= "loadDateRangeFailed";
		public static const LOAD_TEAMVACATION_COMPLETE:String	= "loadTeamVacationComplete";
		public static const LOAD_TEAMVACATION_FAILED:String		= "loadTeamVacationFailed";
		public static const LOAD_VACATIONLIST_COMPLETE:String	= "loadVacationListComplete";
		public static const LOAD_VACATIONLIST_FAILED:String		= "loadVacationListFailed";
		public static const LOAD_REQ_VACATION_COMPLETE:String	= "loadReqVacationComplete";
		public static const LOAD_REQ_VACATION_FAILED:String		= "loadReqVacationFailed";
		public static const DELETE_REQ_VACATION_COMPLETE:String	= "deleteReqVacationComplete";
		public static const DELETE_REQ_VACATION_FAILED:String	= "deleteReqVacationFailed";
		public static const INSERT_REQ_VACATION_COMPLETE:String	= "insertReqVacationComplete";
		public static const INSERT_REQ_VACATION_FAILED:String	= "insertReqVacationFailed";
		public static const INSERT_REQ_WORKTIME_COMPLETE:String	= "insertReqWorkTimeComplete";
		public static const INSERT_REQ_WORKTIME_FAILED:String	= "insertReqWorkTimeFailed";
		public static const UPDATE_REQ_VACATION_COMPLETE:String	= "updateReqVacationComplete";
		public static const UPDATE_REQ_VACATION_FAILED:String	= "updateReqVacationFailed";
		public static const LOAD_VACATION_QUOTA_COMPLETE:String	= "loadVacationQuotaComplete";
		public static const LOAD_VACATION_QUOTA_FAILED:String	= "loadVacationQuotaFailed";
		public static const LOAD_VACATION_CODE_COMPLETE:String	= "loadVacationCodeComplete";
		public static const LOAD_VACATION_CODE_FOR_TIMELIST_COMPLETE:String	= "LOAD_VACATION_CODE_FOR_TIMELIST_COMPLETE";
		
		public static const LOAD_VACATION_CODE_FAILED:String	= "loadVacationCodeaFailed";
		public static const LOAD_NAMESEARCH_COMPLETE:String		= "loadNameSearchComplete";
		public static const LOAD_NAMESEARCH_FAILED:String		= "loadNameSearchFailed";
		public static const LOAD_PROFILE_COMPLETE:String		= "loadProfileComplete";
		public static const LOAD_PROFILE_FAILED:String			= "loadProfileFailed";
		public static const LOAD_OVERTIME_SUM_COMPLETE:String	= "loadOvertimeSumComplete";
		public static const LOAD_OVERTIME_SUM_FAILED:String		= "loadOvertimeSumFailed";
		public static const LOAD_DENIED_WORKTIME_COMPLETE:String= "loadDeniedWorkTimeComplete";
		public static const LOAD_DENIED_WORKTIME_FAILED:String	= "loadDeniedWorkTimeFailed";
		
		public static const SUCCEED_REQ_WORKTIME:String 		= "succeedReqWorkTime";
		public static const CANCEL_REQ_WORKTIME:String			= "cancelReqWorkTime";
		public static const CANCEL_READ_VACATION:String			= "cancelReadVacation";
		public static const CANCEL_READ_WORKTIME:String			= "cancelReadWorktime";
		
		public function WorkFacade( key:String )
		{
			super(key);	
		}
        
        /**
         * Singleton ApplicationFacade Factory Method
         */
        public static function getInstance( key:String ) : WorkFacade 
        {
            if ( instanceMap[ key ] == null ) instanceMap[ key ] = new WorkFacade( key );
            return instanceMap[ key ] as WorkFacade;
        }
        /**
         * Register Commands with the Controller 
         *     - parent 클래스의 생성자에서 자동으로 호출됨
         */
        override protected function initializeController( ) : void {
            super.initializeController();            
            registerCommand( STARTUP, StartupCommand);
        }
       
        /**
         * Module의 시작점으로 Certificate.mxml의 creationComplete 이벤트에서 호출한다.
         *     
         */
        public function startup(app:Object) :void 
        {
        	trace("send startup in Work");
        	this.app = app as DisplayObject;
            sendNotification( STARTUP, app );
        }
		
	}
}